package com.controller;

import com.service.Title_reviewService;
import com.util.Result;
import com.util.Title_review;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@RestController
public class Title_reviewController {
    @Resource
    Title_reviewService title_reviewService;

    @RequestMapping("/apply")
    public Result<?> Apply(@RequestBody Title_review title_review){
        return title_reviewService.apply(title_review);
    }

    @RequestMapping("/search_apply")
    public List<Title_review> Search(@RequestParam("cName") String cName
            ,@RequestParam(value = "pName", required = false) String pName,@RequestParam(value = "pId", required = false) String pId
            ,@RequestParam(value = "statue", required = false) String statue,@RequestParam(value =
            "level", required = false) String level
            ,@RequestParam(value = "year", required = false) Integer year){
        Title_review title_review=new Title_review();
        title_review.setcName(cName);
        title_review.setpName(pName);
        title_review.setpId(pId);
        title_review.setStatue(statue);
        title_review.setLevel(level);
        title_review.setYear(year);
        return title_reviewService.search(title_review);
    }
    @RequestMapping("/handle_apply")
    public Result<?> Handle_apply(@RequestBody Title_review title_review){
        return title_reviewService.handle_apply(title_review);
    }
}
